import { mongo } from "../mogoConfig";

const run = async () => {
    const inventoryTB = mongo.db("my_test").collection("inventory")

    let cursor = inventoryTB.find({ status: 'A' }).project({ item: 1, status: 1, _id: 0 });
    console.log('查询1-------------------')
    for await (const item of cursor) {
        console.log(JSON.stringify(item))
    }

    cursor = inventoryTB.find({ status: 'A' }).project({ item: 1, status: 1, 'size.uom': 1 });
    console.log('查询2-------------------')
    for await (const item of cursor) {
        console.log(JSON.stringify(item))
    }

    
}

run()
    .finally(() => {
        mongo.close()
    })



console.log("执行结束")